package com.streetsmart;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;

import org.json.JSONException;

import android.content.Context;

/**
 * 
 * test case for computing algorithm
 *
 */
public class testcase {
	DBManager dbmanager;
	Context c;
	
	public testcase(Context context){
		dbmanager = new DBManager(context);
		c = context;
	}
	
	public ArrayList<ScheduleListItem> runTestCase() throws ParseException, JSONException{
		
		ArrayList<ScheduleListItem> schedule = new ArrayList<ScheduleListItem>();
		dbmanager.deleteAllEvents();
		
		// First Must to do Event
		MyLocation loc1 = new MyLocation("2535 california st, mountain view, ca");
		Date startTime1 = Utilities.getDate("04/10/2012");
		startTime1.setHours(00);
		startTime1.setMinutes(40);
		Date endTime1 = Utilities.getDate("04/10/2012");
		endTime1.setHours(01);
		endTime1.setMinutes(20);
		MyEvent must1 = new MyEvent("gym", "other", loc1, startTime1, endTime1, "Must");
		
		dbmanager.saveEvent(must1);
		
		// First Good to do Event
		MyLocation loc2 = null;
		Date startTime2 = Utilities.getDate("04/09/2012");
		startTime2.setHours(11);
		startTime2.setMinutes(00);
		Date endTime2 = Utilities.getDate("04/10/2012");
		endTime2.setHours(19);
		endTime2.setMinutes(50);
		MyEvent good1 = new MyEvent("buy grocery", "grocery_or_supermarket", loc2,
				startTime2, endTime2, "Good");

		dbmanager.saveEvent(good1);
		
		// Second Good to do Event
		MyLocation loc3 = null;
		Date startTime3 = Utilities.getDate("04/08/2012");
		startTime3.setHours(19);
		startTime3.setMinutes(10);
		Date endTime3 = Utilities.getDate("04/08/2012");
		endTime3.setHours(22);
		endTime3.setMinutes(35);
		MyEvent good2 = new MyEvent("buy dinner", "restaurant", loc3,
				startTime3, endTime3, "Good");

		//dbmanager.saveEvent(good2);
		MyLocation startAddress = new MyLocation("263 higdon ave, mountain view, ca");
		//MyLocation returnAddress = startAddress;
		MyLocation returnAddress = new MyLocation("2025 stierlin court, mountain view, ca");
		float timeInHand = 2.0f;
		//Algorithm alg = new Algorithm(timeInHand, startAddress, returnAddress, c,);
		//schedule = alg.computeSchedule();
		dbmanager.close();
		return schedule;
	}
	
	
}
